﻿using System;
using System.Collections;
using System.Collections.Generic;
using HoNSharp;

namespace LibBot
{
    public class BuddyWhisperEventArgs : EventArgs
    {
        private string _username;
        private string _message;

        public BuddyWhisperEventArgs(string Username, string Message)
        {
            this._username = Username;
            this._message = Message;
        }

        public string Username
        {
            get { return this._username; }
        }

        public string Message
        {
            get { return this._message; }
        }
    }

    public class ChannelKickEventArgs : EventArgs
    {
        private UInt32 _channelid;
        private string _channelname;
        private UInt32 _kickerid;
        private string _kickername;
        private UInt32 _kickedid;
        private string _kickedname;

        public ChannelKickEventArgs(UInt32 ChannelID, string ChannelName, UInt32 KickerID, string KickerName, UInt32 KickedID, string KickedName)
        {
            this._channelid = ChannelID;
            this._channelname = ChannelName;
            this._kickerid = KickerID;
            this._kickername = KickerName;
            this._kickedid = KickedID;
            this._kickedname = KickedName;
        }

        public UInt32 ChannelID
        {
            get { return this._channelid; }
        }

        public string ChannelName
        {
            get { return this._channelname; }
        }

        public UInt32 KickerID
        {
            get { return this._kickerid; }
        }

        public string KickerName
        {
            get { return this._kickername; }
        }

        public UInt32 KickedID
        {
            get { return this._kickedid; }
        }

        public string KickedName
        {
            get { return this._kickedname; }
        }
    }

    public class ChannelMessageEventArgs : EventArgs
    {
        private UInt32 _channelid;
        private string _channelname;
        private UInt32 _userid;
        private string _username;
        private string _message;

        public ChannelMessageEventArgs(UInt32 ChannelID, string ChannelName, UInt32 UserID, string Username, string Message)
        {
            this._channelid = ChannelID;
            this._channelname = ChannelName;
            this._userid = UserID;
            this._username = Username;
            this._message = Message;
        }

        public UInt32 ChannelID
        {
            get { return this._channelid; }
        }

        public string ChannelName
        {
            get { return this._channelname; }
        }

        public UInt32 UserID
        {
            get { return this._userid; }
        }

        public string Username
        {
            get { return this._username; }
        }

        public string Message
        {
            get { return this._message; }
        }
    }

    public class ClanInvitationEventArgs : EventArgs
    {
        private string _clanname;
        private UInt32 _userid;
        private string _username;

        public ClanInvitationEventArgs(string ClanName, UInt32 UserID, string Username)
        {
            this._clanname = ClanName;
            this._userid = UserID;
            this._username = Username;
        }

        public string ClanName
        {
            get { return this._clanname; }
        }

        public UInt32 UserID
        {
            get { return this._userid; }
        }

        public string Username
        {
            get { return this._username; }
        }
    }

    public class ClanMessageEventArgs : EventArgs
    {
        private UInt32 _userid;
        private string _username;
        private string _message;

        public ClanMessageEventArgs(UInt32 UserID, string Username, string Message)
        {
            this._userid = UserID;
            this._username = Username;
            this._message = Message;
        }

        public UInt32 UserID
        {
            get { return this._userid; }
        }

        public string Username
        {
            get { return this._username; }
        }

        public string Message
        {
            get { return this._message; }
        }
    }

    public class CommandEventArgs : EventArgs
    {
        private UInt32 _channelid;
        private string _channelname;
        private UInt32 _userid;
        private string _username;
        private List<char> _botflags;
        private string _command;
        private string _parameters;

        public CommandEventArgs(UInt32 ChannelID, string ChannelName, UInt32 UserID, string Username, List<char> BotFlags, string Command, string Parameters)
        {
            this._channelid = ChannelID;
            this._channelname = ChannelName;
            this._userid = UserID;
            this._username = Username;
            this._botflags = BotFlags;
            this._command = Command;
            this._parameters = Parameters;
        }

        public UInt32 ChannelID
        {
            get { return this._channelid; }
        }

        public string ChannelName
        {
            get { return this._channelname; }
        }

        public UInt32 UserID
        {
            get { return this._userid; }
        }

        public string Username
        {
            get { return this._username; }
        }

        public List<char> BotFlags
        {
            get { return this._botflags; }
        }

        public string Command
        {
            get { return this._command; }
        }

        public string Parameters
        {
            get { return this._parameters; }
        }

        public bool GetParameters(int Count, out string[] Parameters)
        {
            char[] separator = { ' ' };
            Parameters = this._parameters.Split(separator, Count);

            if (Parameters.Length == Count)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }

    public class DiceRollEventArgs : EventArgs
    {
        private UInt32 _channelid;
        private string _channelname;
        private UInt32 _userid;
        private string _username;
        private string _message;

        public DiceRollEventArgs(UInt32 ChannelID, string ChannelName, UInt32 UserID, string Username, string Message)
        {
            this._channelid = ChannelID;
            this._channelname = ChannelName;
            this._userid = UserID;
            this._username = Username;
            this._message = Message;
        }

        public UInt32 ChannelID
        {
            get { return this._channelid; }
        }

        public string ChannelName
        {
            get { return this._channelname; }
        }

        public UInt32 UserID
        {
            get { return this._userid; }
        }

        public string Username
        {
            get { return this._username; }
        }

        public string Message
        {
            get { return this._message; }
        }
    }

    public class DisconnectEventArgs : EventArgs
    {
        private string _reason;

        public DisconnectEventArgs(string Reason)
        {
            this._reason = Reason;
        }

        public string Reason
        {
            get { return this._reason; }
        }
    }

    public class EmoteEventArgs : EventArgs
    {
        private UInt32 _channelid;
        private string _channelname;
        private UInt32 _userid;
        private string _username;
        private string _message;

        public EmoteEventArgs(UInt32 ChannelID, string ChannelName, UInt32 UserID, string Username, string Message)
        {
            this._channelid = ChannelID;
            this._channelname = ChannelName;
            this._userid = UserID;
            this._username = Username;
            this._message = Message;
        }

        public UInt32 ChannelID
        {
            get { return this._channelid; }
        }

        public string ChannelName
        {
            get { return this._channelname; }
        }

        public UInt32 UserID
        {
            get { return this._userid; }
        }

        public string Username
        {
            get { return this._username; }
        }

        public string Message
        {
            get { return this._message; }
        }
    }

    public class InitialStatusEventArgs : EventArgs
    {
        private HoNBuddy[] _buddies;

        public InitialStatusEventArgs(HoNBuddy[] Buddies)
        {
            this._buddies = Buddies;
        }

        public HoNBuddy[] Buddies
        {
            get { return this._buddies; }
        }
    }

    public class InstantMessageEventArgs : EventArgs
    {
        private string _username;
        private string _message;

        public InstantMessageEventArgs(string Username, string Message)
        {
            this._username = Username;
            this._message = Message;
        }

        public string Username
        {
            get { return this._username; }
        }

        public string Message
        {
            get { return this._message; }
        }
    }

    public class LeaveChannelEventArgs : EventArgs
    {
        private UInt32 _channelid;
        private string _channelname;

        public LeaveChannelEventArgs(UInt32 ChannelID, string ChannelName)
        {
            this._channelid = ChannelID;
            this._channelname = ChannelName;
        }

        public UInt32 ChannelID
        {
            get { return this._channelid; }
        }

        public string ChannelName
        {
            get { return this._channelname; }
        }
    }

    public class LoginCompleteEventArgs : EventArgs
    {
        private string _message;
        private bool _isloggedin;
        private Hashtable _data;

        public LoginCompleteEventArgs(bool IsLoggedIn, string Message, Hashtable Data)
        {
            this._isloggedin = IsLoggedIn;
            this._message = Message;
            this._data = Data;
        }

        public bool IsLoggedIn
        {
            get { return this._isloggedin; }
        }

        public string Message
        {
            get { return this._message; }
        }

        public UInt32 UserID
        {
            get { return UInt32.Parse((string)this._data["account_id"]); }
        }

        public List<HoNBuddy> BuddyList
        {
            get
            {
                List<HoNBuddy> _buddies = new List<HoNBuddy>();

                if ((Hashtable)this._data["buddy_list"] != null)
                {
                    ArrayList _buddylist = new ArrayList();
                    _buddylist = (ArrayList)((Hashtable)this._data["buddy_list"])[int.Parse((string)this._data["account_id"])];

                    foreach (Hashtable buddy in _buddylist)
                    {
                        HoNBuddy honbuddy = new HoNBuddy();

                        honbuddy.Username = (string)buddy["nickname"];
                        honbuddy.UserID = uint.Parse((string)buddy["buddy_id"]);
                        honbuddy.Status = byte.Parse((string)buddy["status"]);

                        _buddies.Add(honbuddy);
                    }
                }

                return _buddies;
            }
        }

        public List<HoNUser> ClanRoster
        {
            get
            {
                List<HoNUser> _members = new List<HoNUser>();
                    Hashtable _clanroster = new Hashtable();
                    _clanroster = (Hashtable)this._data["clan_roster"];

                if (_clanroster["error"] == null)
                {

                    foreach (Hashtable member in _clanroster.Values)
                    {
                        HoNUser user = new HoNUser();

                        user.Username = (string)member["nickname"];
                        user.UserID = uint.Parse((string)member["account_id"]);
                        user.Status = 0;

                        _members.Add(user);
                    }
                }

                return _members;
            }
        }

        public List<string> Chatrooms
        {
            get
            {
                List<string> _chatrooms = new List<string>();

                if (this._data["chatrooms"].GetType().ToString() != "System.String")
                {
                    foreach (string chatroom in ((Hashtable)this._data["chatrooms"]).Values)
                    {
                        _chatrooms.Add(chatroom);
                    }
                }

                return _chatrooms;
            }
        }
    }

    public class NameChangedEventArgs : EventArgs
    {
        private UInt32 _userid;
        private string _username;

        public NameChangedEventArgs(UInt32 UserID, string Username)
        {
            this._userid = UserID;
            this._username = Username;
        }

        public UInt32 UserID
        {
            get { return this._userid; }
        }

        public string Username
        {
            get { return this._username; }
        }
    }

    public class NewChannelEventArgs : EventArgs
    {
        private UInt32 _channelid;
        private string _channelname;
        private string _topic;
        private HoNOper[] _operators;
        private HoNUser[] _users;
        private int _usercount;

        public NewChannelEventArgs(UInt32 ChannelID, string ChannelName, string Topic, HoNOper[] Operators, HoNUser[] Users, UInt32 UserCount)
        {
            this._channelid = ChannelID;
            this._channelname = ChannelName;
            this._topic = Topic;
            this._operators = Operators;
            this._users = Users;
            this._usercount = (int)UserCount;
        }

        public UInt32 ChannelID
        {
            get { return this._channelid; }
        }

        public string ChannelName
        {
            get { return this._channelname; }
        }

        public string Topic
        {
            get { return this._topic; }
        }

        public HoNOper[] Operators
        {
            get { return this._operators; }
        }

        public HoNUser[] Users
        {
            get { return this._users; }
        }

        public int UserCount
        {
            get { return this._usercount; }
        }
    }

    public class PlayerDemotedEventArgs : EventArgs
    {
        private UInt32 _channelid;
        private string _channelname;
        private UInt32 _operatorid;
        private string _operatorname;
        private UInt32 _targetid;
        private string _targetname;

        public PlayerDemotedEventArgs(UInt32 ChannelID, string ChannelName, UInt32 OperatorID, string OperatorName, UInt32 TargetID, string TargetName)
        {
            this._channelid = ChannelID;
            this._channelname = ChannelName;
            this._operatorid = OperatorID;
            this._operatorname = OperatorName;
            this._targetid = TargetID;
            this._targetname = TargetName;
        }

        public UInt32 ChannelID
        {
            get { return this._channelid; }
        }

        public string ChannelName
        {
            get { return this._channelname; }
        }

        public UInt32 OperatorID
        {
            get { return this._operatorid; }
        }

        public string OperatorName
        {
            get { return this._operatorname; }
        }

        public UInt32 TargetID
        {
            get { return this._targetid; }
        }

        public string TargetName
        {
            get { return this._targetname; }
        }
    }

    public class PlayerJoinedChannelEventArgs : EventArgs
    {
        private UInt32 _channelid;
        private string _channelname;
        private HoNUser _user;

        public PlayerJoinedChannelEventArgs(UInt32 ChannelID, string ChannelName, HoNUser User)
        {
            this._channelid = ChannelID;
            this._channelname = ChannelName;
            this._user = User;
        }

        public UInt32 ChannelID
        {
            get { return this._channelid; }
        }

        public string ChannelName
        {
            get { return this._channelname; }
        }

        public HoNUser User
        {
            get { return this._user; }
        }
    }

    public class PlayerLeftChannelEventArgs : EventArgs
    {
        private UInt32 _channelid;
        private string _channelname;
        private UInt32 _userid;
        private string _username;

        public PlayerLeftChannelEventArgs(UInt32 ChannelID, string ChannelName, UInt32 UserID, string Username)
        {
            this._channelid = ChannelID;
            this._channelname = ChannelName;
            this._userid = UserID;
            this._username = Username;
        }

        public UInt32 ChannelID
        {
            get { return this._channelid; }
        }

        public string ChannelName
        {
            get { return this._channelname; }
        }

        public UInt32 UserID
        {
            get { return this._userid; }
        }

        public string Username
        {
            get { return this._username; }
        }
    }

    public class PlayerPromotedEventArgs : EventArgs
    {        
        private UInt32 _channelid;
        private string _channelname;
        private UInt32 _operatorid;
        private string _operatorname;
        private UInt32 _targetid;
        private string _targetname;

        public PlayerPromotedEventArgs(UInt32 ChannelID, string ChannelName, UInt32 OperatorID, string OperatorName, UInt32 TargetID, string TargetName)
        {
            this._channelid = ChannelID;
            this._channelname = ChannelName;
            this._operatorid = OperatorID;
            this._operatorname = OperatorName;
            this._targetid = TargetID;
            this._targetname = TargetName;
        }

        public UInt32 ChannelID
        {
            get { return this._channelid; }
        }

        public string ChannelName
        {
            get { return this._channelname; }
        }

        public UInt32 OperatorID
        {
            get { return this._operatorid; }
        }

        public string OperatorName
        {
            get { return this._operatorname; }
        }

        public UInt32 TargetID
        {
            get { return this._targetid; }
        }

        public string TargetName
        {
            get { return this._targetname; }
        }
    }

    public class PluginConflictEventArgs : EventArgs
    {
        private string _loadedplugin;
        private string _conflictingplugin;
        private char _conflictingflag;

        public PluginConflictEventArgs(string LoadedPlugin, string ConflictingPlugin, char ConflictingFlag)
        {
            this._loadedplugin = LoadedPlugin;
            this._conflictingplugin = ConflictingPlugin;
            this._conflictingflag = ConflictingFlag;
        }

        public string LoadedPlugin
        {
            get { return this._loadedplugin; }
        }

        public string ConflictingPlugin
        {
            get { return this._conflictingplugin; }
        }

        public char ConflictingFlag
        {
            get { return this._conflictingflag; }
        }
    }

    public class SendChannelMessageEventArgs : EventArgs
    {
        private UInt32 _channelid;
        private string _message;

        public SendChannelMessageEventArgs(UInt32 ChannelID, string Message)
        {
            this._channelid = ChannelID;
            this._message = Message;
        }

        public UInt32 ChannelID
        {
            get { return this._channelid; }
        }

        public string Message
        {
            get { return this._message; }
        }
    }

    public class SendClanInviteEventArgs : EventArgs
    {
        private string _username;

        public SendClanInviteEventArgs(string Username)
        {
            this._username = Username;
        }

        public string Username
        {
            get { return this._username; }
        }
    }

    public class SendClanMessageEventArgs : EventArgs
    {
        private string _message;

        public SendClanMessageEventArgs(string Message)
        {
            this._message = Message;
        }

        public string Message
        {
            get { return this._message; }
        }
    }

    public class SendEmoteEventArgs : EventArgs
    {
        private UInt32 _channelid;
        private string _message;

        public SendEmoteEventArgs(UInt32 ChannelID, string Message)
        {
            this._channelid = ChannelID;
            this._message = Message;
        }

        public UInt32 ChannelID
        {
            get { return this._channelid; }
        }

        public string Message
        {
            get { return this._message; }
        }
    }

    public class SendInstantMessageEventArgs : EventArgs
    {
        private string _username;
        private string _message;

        public SendInstantMessageEventArgs(string Username, string Message)
        {
            this._username = Username;
            this._message = Message;
        }

        public string Username
        {
            get { return this._username; }
        }

        public string Message
        {
            get { return this._message; }
        }
    }

    public class SendWhisperEventArgs : EventArgs
    {
        private string _username;
        private string _message;

        public SendWhisperEventArgs(string Username, string Message)
        {
            this._username = Username;
            this._message = Message;
        }

        public string Username
        {
            get { return this._username; }
        }

        public string Message
        {
            get { return this._message; }
        }
    }

    public class SilenceLiftedEventArgs : EventArgs
    {
        private UInt32 _channelid;
        private string _channelname;

        public SilenceLiftedEventArgs(UInt32 ChannelID, string ChannelName)
        {
            this._channelid = ChannelID;
            this._channelname = ChannelName;
        }

        public UInt32 ChannelID
        {
            get { return this._channelid; }
        }

        public string ChannelName
        {
            get { return this._channelname; }
        }
    }

    public class SilencePlacedEventArgs : EventArgs
    {
        private UInt32 _channelid;
        private string _channelname;
        private UInt32 _muterid;
        private string _mutername;
        private UInt32 _mutedid;
        private string _mutedname;
        private int _duration;

        public SilencePlacedEventArgs(UInt32 ChannelID, string ChannelName, UInt32 MuterID, string MuterName, UInt32 MutedID, string MutedName, int Duration)
        {
            this._channelid = ChannelID;
            this._channelname = ChannelName;
            this._muterid = MuterID;
            this._mutername = MuterName;
            this._mutedid = MutedID;
            this._mutedname = MutedName;
            this._duration = Duration;
        }

        public UInt32 ChannelID
        {
            get { return this._channelid; }
        }

        public string ChannelName
        {
            get { return this._channelname; }
        }

        public UInt32 MuterID
        {
            get { return this._channelid; }
        }

        public string MuterName
        {
            get { return this._channelname; }
        }

        public UInt32 MutedID
        {
            get { return this._channelid; }
        }

        public string MutedName
        {
            get { return this._channelname; }
        }

        public int Duration
        {
            get { return this._duration; }
        }
    }

    public class SlashCommandEventArgs : EventArgs
    {
        string _command;
        string _parameters;

        public SlashCommandEventArgs(string Command, string Parameters)
        {
            this._command = Command;
            this._parameters = Parameters;
        }

        public string Command
        {
            get { return this._command; }
        }

        public string Parameters
        {
            get { return this._parameters; }
        }

        public bool GetParameters(int Count, out string[] Parameters)
        {
            char[] separator = { ' ' };
            Parameters = this._parameters.Split(separator, Count);

            if (Parameters.Length == Count)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }

    public class StatusUpdateEventArgs : EventArgs
    {
        private UInt32 _userid;
        private string _username;
        private byte _status;
        private byte _flags;
        private UInt32 _clanid;
        private string _clan;
        private string _gameserver;
        private UInt32 _gameid;
        private string _gamename;

        public StatusUpdateEventArgs(UInt32 UserID, string Username, byte Status, byte Flags, UInt32 ClanID, string Clan, string GameServer, UInt32 GameID, string GameName)
        {
            this._userid = UserID;
            this._username = Username;
            this._status = Status;
            this._flags = Flags;
            this._clanid = ClanID;
            this._clan = Clan;
            this._gameserver = GameServer;
            this._gameid = GameID;
            this._gamename = GameName;
        }

        public UInt32 UserID
        {
            get { return this._userid; }
        }

        public string Username
        {
            get { return this._username; }
        }

        public byte Status
        {
            get { return this._status; }
        }

        public byte Flags
        {
            get { return this._flags; }
        }

        public UInt32 ClanID
        {
            get { return this._clanid; }
        }

        public string Clan
        {
            get { return this._clan; }
        }

        public string GameServer
        {
            get { return this._gameserver; }
        }

        public UInt32 GameID
        {
            get { return this._gameid; }
        }

        public string GameName
        {
            get { return this._gamename; }
        }
    }

    public class TopicChangedEventArgs : EventArgs
    {
        private UInt32 _channelid;
        private string _channelname;
        private string _topic;

        public TopicChangedEventArgs(UInt32 ChannelID, string ChannelName, string Topic)
        {
            this._channelid = ChannelID;
            this._channelname = ChannelName;
            this._topic = Topic;
        }

        public UInt32 ChannelID
        {
            get { return this._channelid; }
        }

        public string ChannelName
        {
            get { return this._channelname; }
        }

        public string Topic
        {
            get { return this._topic; }
        }
    }

    public class WhisperEventArgs : EventArgs
    {
        private string _username;
        private string _message;

        public WhisperEventArgs(string Username, string Message)
        {
            this._username = Username;
            this._message = Message;
        }

        public string Username
        {
            get { return this._username; }
        }

        public string Message
        {
            get { return this._message; }
        }
    }

    public class WhoisCompleteEventArgs : EventArgs
    {
        private Core.WhoisType _type;
        private HoNUserInfoInGameArgs _ingameargs;
        private HoNUserInfoNoExistArgs _noexistargs;
        private HoNUserInfoOfflineArgs _offlineargs;
        private HoNUserInfoOnlineArgs _onlineargs;

        public WhoisCompleteEventArgs(Core.WhoisType Type, HoNUserInfoInGameArgs InGameArgs, HoNUserInfoNoExistArgs NoExistArgs, HoNUserInfoOfflineArgs OfflineArgs, HoNUserInfoOnlineArgs OnlineArgs)
        {
            this._type = Type;
            this._ingameargs = InGameArgs;
            this._noexistargs = NoExistArgs;
            this._offlineargs = OfflineArgs;
            this._onlineargs = OnlineArgs;
        }

        public Core.WhoisType Type
        {
            get { return this._type; }
        }

        public HoNUserInfoInGameArgs InGameArgs
        {
            get { return this._ingameargs; }
        }

        public HoNUserInfoNoExistArgs NoExistArgs
        {
            get { return this._noexistargs; }
        }

        public HoNUserInfoOfflineArgs OfflineArgs
        {
            get { return this._offlineargs; }
        }

        public HoNUserInfoOnlineArgs OnlineArgs
        {
            get { return this._onlineargs; }
        }
    }
}
